float totalScore = 0;
float maxPoints = 0;
float levelScore = 0;
float levelPerc = 0.0;
float totalPerc = 0.0;
int minScore = 8;
PFont fontB;

void scoreSetup() {
    fontB = loadFont("SakkalMajallaBold-100.vlw");
}

void score(String userInput, String compInput) {
  int[] userElems = int(split(userInput,":"));
  int[] compElems = int(split(compInput,":"));
  
  levelScore = 3;
  
  if(userElems.length != compElems.length)
  {
    levelScore = -(max(userElems.length, compElems.length) - min(userElems.length, compElems.length));
    println("element strings not equals");  
  }
  
  int j = 0;
  for(int i = 0; i < min(userElems.length, compElems.length);i++)
  {
    if(userElems[i] == compElems[i])
    {
      levelScore++;
    }
    else
    {
      j++;
      while((i+j) < compElems.length)
      {
        if(userElems[i] == compElems[i+j])
        {
          levelScore++;
          break;
        }
        j++;
      }
    }
  }
    
  
  println(levelScore);
  maxPoints += 10;
  totalScore += levelScore;
  levelPerc = levelScore/10*100;
  totalPerc = totalScore/maxPoints*100;
}

void displayScores() {
 textFont(fontB, 100);
 if(levelScore < minScore+difficulty)
   fill(255,0,0);
 else
   fill(0,255,0);
 text("Level Score", 30, 300);
 text((int)levelPerc + "%", 130, 400); 
 text("Total Score", 500, 300);
 text((int)totalPerc + "%", 600, 400);
}
  
  
  
  
